package com.leizi.igym.enums;

/**
 * @Author: leizi0110
 * @CreateTime: 2024-05-03  16:41
 * @Description:
 */

public enum CardEnum {
    WEEK_CARD("周卡会员", 1, 7),
    MONTH_CARD("月卡会员", 2, 30),
    YEAR_CARD("年卡会员", 3, 365);

    private final String name;
    private final Integer id;
    private final Integer date;

    CardEnum(String name, Integer id, Integer date) {
        this.name = name;
        this.id = id;
        this.date = date;
    }

    public String getName() {
        return name;
    }

    public Integer getId() {
        return id;
    }

    public Integer getDate() {
        return date;
    }


    public static Integer getDateNum(String name) {
        if ("".equals(name)) {
            return 0;
        }
        for (CardEnum anEnum : CardEnum.values()) {
            if (anEnum.getName().equals(name)){
                return anEnum.getDate();
            }
        }
        return 0;
    }
}
